package com.yugao.fintech.draper.hazelcast.config;

import com.hazelcast.core.HazelcastInstance;
import com.yugao.fintech.draper.hazelcast.cache.DefaultCacheManager;
import com.yugao.fintech.draper.hazelcast.cache.DistributedCacheProvider;
import com.yugao.fintech.draper.hazelcast.cache.HazelcastCacheProvider;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
@AutoConfiguration
public class HazelcastCacheAutoConfiguration {
	@Bean
	DistributedCacheProvider hazelcastCacheProvider(
			@Qualifier("hazelcastInstance") HazelcastInstance hazelcastInstance) {
		return new HazelcastCacheProvider(hazelcastInstance);
	}

	@Bean
	DefaultCacheManager defaultCacheManager(DistributedCacheProvider distributedCacheProvider) {
		return new DefaultCacheManager(distributedCacheProvider);
	}
}
